package pojo.entity;

import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Past;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 吴阳基
 * @datetime 2024/1/15 19:55
 */
public class SysUser {

    private long id;
    @NotEmpty(message = "用户编码不能为空")
    private String account;
    @NotEmpty(message = "用户名称不能为空")
    private String realName;
    @NotEmpty(message = "用户密码不能为空")
    @Length(min = 6,max = 10,message = "用户密码长度为6-10")
    private String password;
    private long sex;
    @Past(message = "必须是一个过去的时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime birthday;
    private String phone;
    private String address;
    private long roleId;
    private long createdUserId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime createdTime;
    private long updatedUserId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime updatedTime;
    private SysRole sysRole;
    private List<Address> addressList;
    private String roleIdName;

    public SysUser(long id, String account, String realName, String password, long sex, LocalDateTime birthday, String phone, String address, long roleId, long createdUserId, LocalDateTime createdTime, long updatedUserId, LocalDateTime updatedTime) {
        this.id = id;
        this.account = account;
        this.realName = realName;
        this.password = password;
        this.sex = sex;
        this.birthday = birthday;
        this.phone = phone;
        this.address = address;
        this.roleId = roleId;
        this.createdUserId = createdUserId;
        this.createdTime = createdTime;
        this.updatedUserId = updatedUserId;
        this.updatedTime = updatedTime;

    }

    public SysUser() {
    }


    public SysUser(long id, String account, String realName, String password, long sex, LocalDateTime birthday, String phone, String address, long roleId, long createdUserId, LocalDateTime createdTime, long updatedUserId, LocalDateTime updatedTime, SysRole sysRole, List<Address> addressList, String roleIdName) {
        this.id = id;
        this.account = account;
        this.realName = realName;
        this.password = password;
        this.sex = sex;
        this.birthday = birthday;
        this.phone = phone;
        this.address = address;
        this.roleId = roleId;
        this.createdUserId = createdUserId;
        this.createdTime = createdTime;
        this.updatedUserId = updatedUserId;
        this.updatedTime = updatedTime;
        this.sysRole = sysRole;
        this.addressList = addressList;
        this.roleIdName = roleIdName;
    }


    /**
     * 获取
     * @return id
     */
    public long getId() {
        return id;
    }

    /**
     * 设置
     * @param id
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * 获取
     * @return account
     */
    public String getAccount() {
        return account;
    }

    /**
     * 设置
     * @param account
     */
    public void setAccount(String account) {
        this.account = account;
    }

    /**
     * 获取
     * @return realName
     */
    public String getRealName() {
        return realName;
    }

    /**
     * 设置
     * @param realName
     */
    public void setRealName(String realName) {
        this.realName = realName;
    }

    /**
     * 获取
     * @return password
     */
    public String getPassword() {
        return password;
    }

    /**
     * 设置
     * @param password
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * 获取
     * @return sex
     */
    public long getSex() {
        return sex;
    }

    /**
     * 设置
     * @param sex
     */
    public void setSex(long sex) {
        this.sex = sex;
    }

    /**
     * 获取
     * @return birthday
     */
    public LocalDateTime getBirthday() {
        return birthday;
    }

    /**
     * 设置
     * @param birthday
     */
    public void setBirthday(LocalDateTime birthday) {
        this.birthday = birthday;
    }

    /**
     * 获取
     * @return phone
     */
    public String getPhone() {
        return phone;
    }

    /**
     * 设置
     * @param phone
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * 获取
     * @return address
     */
    public String getAddress() {
        return address;
    }

    /**
     * 设置
     * @param address
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * 获取
     * @return roleId
     */
    public long getRoleId() {
        return roleId;
    }

    /**
     * 设置
     * @param roleId
     */
    public void setRoleId(long roleId) {
        this.roleId = roleId;
    }

    /**
     * 获取
     * @return createdUserId
     */
    public long getCreatedUserId() {
        return createdUserId;
    }

    /**
     * 设置
     * @param createdUserId
     */
    public void setCreatedUserId(long createdUserId) {
        this.createdUserId = createdUserId;
    }

    /**
     * 获取
     * @return createdTime
     */
    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    /**
     * 设置
     * @param createdTime
     */
    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    /**
     * 获取
     * @return updatedUserId
     */
    public long getUpdatedUserId() {
        return updatedUserId;
    }

    /**
     * 设置
     * @param updatedUserId
     */
    public void setUpdatedUserId(long updatedUserId) {
        this.updatedUserId = updatedUserId;
    }

    /**
     * 获取
     * @return updatedTime
     */
    public LocalDateTime getUpdatedTime() {
        return updatedTime;
    }

    /**
     * 设置
     * @param updatedTime
     */
    public void setUpdatedTime(LocalDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    /**
     * 获取
     * @return sysRole
     */
    public SysRole getSysRole() {
        return sysRole;
    }

    /**
     * 设置
     * @param sysRole
     */
    public void setSysRole(SysRole sysRole) {
        this.sysRole = sysRole;
    }

    /**
     * 获取
     * @return addressList
     */
    public List<Address> getAddressList() {
        return addressList;
    }

    /**
     * 设置
     * @param addressList
     */
    public void setAddressList(List<Address> addressList) {
        this.addressList = addressList;
    }

    public String toString() {
        return "SysUser{id = " + id + ", account = " + account + ", realName = " + realName + ", password = " + password + ", sex = " + sex + ", birthday = " + birthday + ", phone = " + phone + ", address = " + address + ", roleId = " + roleId + ", createdUserId = " + createdUserId + ", createdTime = " + createdTime + ", updatedUserId = " + updatedUserId + ", updatedTime = " + updatedTime + ", sysRole = " + sysRole + ", addressList = " + addressList + "}";
    }

    /**
     * 获取
     * @return roleIdName
     */
    public String getRoleIdName() {
        return roleIdName;
    }

    /**
     * 设置
     * @param roleIdName
     */
    public void setRoleIdName(String roleIdName) {
        this.roleIdName = roleIdName;
    }
}
